package com.shopx.cm.controller;

import com.shopx.base.anno.ShopxCheckParamAnno;
import lombok.extern.slf4j.Slf4j;
import com.shopx.base.anno.ShopxParamAnno;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.shopx.base.controller.BaseController;

import javax.annotation.Resource;

import com.shopx.cmm.DTO.PageDTO;
import com.shopx.base.dto.Result;
import com.shopx.base.utils.ResultUtil;
import com.shopx.base.exception.ShopxException;
import com.shopx.cm.bean.CmBrandCk;
import com.shopx.cm.model.CmBrandCkModel;
import com.shopx.cm.service.ICmBrandCkService;

import com.shopx.base.anno.RepearSubmitChkAnno;
import com.shopx.core.common.CommonConstant;

/**
 * TODO
 *
 * @author lituo
 * @className: CmBrandCkController
 * @date 2025-02-21
 */
@RestController
@Slf4j
@RequestMapping(value = "/cmBrandCk")
public class CmBrandCkController extends BaseController {

    @Resource
    private ICmBrandCkService cmBrandCkService;

    @PostMapping(value = "/queryPageList")
    @ShopxParamAnno
    @ShopxCheckParamAnno
    public Result<PageDTO> queryPageList(@RequestBody CmBrandCkModel cmBrandCk) throws ShopxException {
        PageDTO<CmBrandCkModel> pageDTO = cmBrandCkService.getListPage(cmBrandCk);
        return ResultUtil.ok(pageDTO);
    }

    @PostMapping(value = "/insertOne")
    @RepearSubmitChkAnno(lockTime = CommonConstant.REQ_TM)
    @ShopxParamAnno
    public Result<Integer> insertOne(@RequestBody CmBrandCk cmBrandCk) throws ShopxException {
        int result = cmBrandCkService.insertSelective(cmBrandCk);
        return ResultUtil.ok(result);
    }

    @PostMapping(value = "/updateOne")
    @RepearSubmitChkAnno(lockTime = CommonConstant.REQ_TM)
    @ShopxParamAnno
    public Result<Integer> updateOne(@RequestBody CmBrandCk cmBrandCk) throws ShopxException {
        int result = cmBrandCkService.updateByPrimaryKeySelective(cmBrandCk);
        return ResultUtil.ok(result);
    }

    @PostMapping(value = "/queryOneByPrimaryKey")
    public Result<CmBrandCkModel> queryOneByPrimaryKey(@RequestBody CmBrandCk cmBrandCk) throws ShopxException {
        CmBrandCkModel result = cmBrandCkService.selectByPrimaryKey(cmBrandCk);
        return ResultUtil.ok(result);
    }

	/*@PostMapping(value = "/deleteChecked")
	@RepearSubmitChkAnno(lockTime = CommonConstant.REQ_TM)
					@ShopxParamAnno
public Result<Integer> deleteChecked(@RequestBody CmBrandCk cmBrandCk) throws ShopxException {
		int result = cmBrandCkService.deleteByPrimaryKey(cmBrandCk);
		return ResultUtil.ok(result);
	}*/
}

